3.34 \(\int \cos (c+d x) (a \cos (c+d x)+b \sin (c+d x)) \, dx\)

Optimal. Leaf size=43 \[ \frac{a \sin (c+d x) \cos (c+d x)}{2 d}+\frac{a x}{2}+\frac{b \sin ^2(c+d x)}{2 d} \]

[Out]

(a*x)/2 + (a*Cos[c + d*x]*Sin[c + d*x])/(2*d) + (b*Sin[c + d*x]^2)/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0434389, antiderivative size = 43, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 24, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.208, Rules used = {3090, 2635, 8, 2564, 30} \[ \frac{a \sin (c+d x) \cos (c+d x)}{2 d}+\frac{a x}{2}+\frac{b \sin ^2(c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a*Cos[c + d*x] + b*Sin[c + d*x]),x]

[Out]

(a*x)/2 + (a*Cos[c + d*x]*Sin[c + d*x])/(2*d) + (b*Sin[c + d*x]^2)/(2*d)

Rule 3090

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[cos[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2564

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rubi steps

\begin{align*} \int \cos (c+d x) (a \cos (c+d x)+b \sin (c+d x)) \, dx &=\int \left (a \cos ^2(c+d x)+b \cos (c+d x) \sin (c+d x)\right ) \, dx\\ &=a \int \cos ^2(c+d x) \, dx+b \int \cos (c+d x) \sin (c+d x) \, dx\\ &=\frac{a \cos (c+d x) \sin (c+d x)}{2 d}+\frac{1}{2} a \int 1 \, dx+\frac{b \operatorname{Subst}(\int x \, dx,x,\sin (c+d x))}{d}\\ &=\frac{a x}{2}+\frac{a \cos (c+d x) \sin (c+d x)}{2 d}+\frac{b \sin ^2(c+d x)}{2 d}\\ \end{align*}

Mathematica [A]  time = 0.0486597, size = 46, normalized size = 1.07 \[ \frac{a (c+d x)}{2 d}+\frac{a \sin (2 (c+d x))}{4 d}-\frac{b \cos ^2(c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a*Cos[c + d*x] + b*Sin[c + d*x]),x]

[Out]

(a*(c + d*x))/(2*d) - (b*Cos[c + d*x]^2)/(2*d) + (a*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]  time = 0.033, size = 41, normalized size = 1. \begin{align*}{\frac{1}{d} \left ( a \left ({\frac{\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) -{\frac{ \left ( \cos \left ( dx+c \right ) \right ) ^{2}b}{2}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a*cos(d*x+c)+b*sin(d*x+c)),x)

[Out]

1/d*(a*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)-1/2*cos(d*x+c)^2*b)

________________________________________________________________________________________

Maxima [A]  time = 1.23586, size = 50, normalized size = 1.16 \begin{align*} -\frac{2 \, b \cos \left (d x + c\right )^{2} -{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/4*(2*b*cos(d*x + c)^2 - (2*d*x + 2*c + sin(2*d*x + 2*c))*a)/d

________________________________________________________________________________________

Fricas [A]  time = 0.467528, size = 86, normalized size = 2. \begin{align*} \frac{a d x - b \cos \left (d x + c\right )^{2} + a \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(a*d*x - b*cos(d*x + c)^2 + a*cos(d*x + c)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [A]  time = 0.276042, size = 73, normalized size = 1.7 \begin{align*} \begin{cases} \frac{a x \sin ^{2}{\left (c + d x \right )}}{2} + \frac{a x \cos ^{2}{\left (c + d x \right )}}{2} + \frac{a \sin{\left (c + d x \right )} \cos{\left (c + d x \right )}}{2 d} - \frac{b \cos ^{2}{\left (c + d x \right )}}{2 d} & \text{for}\: d \neq 0 \\x \left (a \cos{\left (c \right )} + b \sin{\left (c \right )}\right ) \cos{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*cos(d*x+c)+b*sin(d*x+c)),x)

[Out]

Piecewise((a*x*sin(c + d*x)**2/2 + a*x*cos(c + d*x)**2/2 + a*sin(c + d*x)*cos(c + d*x)/(2*d) - b*cos(c + d*x)*
*2/(2*d), Ne(d, 0)), (x*(a*cos(c) + b*sin(c))*cos(c), True))

________________________________________________________________________________________

Giac [A]  time = 1.09206, size = 47, normalized size = 1.09 \begin{align*} \frac{1}{2} \, a x - \frac{b \cos \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac{a \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="giac")

[Out]

1/2*a*x - 1/4*b*cos(2*d*x + 2*c)/d + 1/4*a*sin(2*d*x + 2*c)/d